<?php $this->load->view('header/admin'); ?>
<div id="main">
    <div class="container">
        <div class="span-17 colborder" id="content">
	        <?php if (isset($messages)) echo $messages; ?>
	        <h3>Profile Search</h3>
	        <div id="profile-search">
	            <?php echo form_open('admin/search')?>
	            <?php if (isset($forward_url)): ?>
	               <?php echo form_hidden('forward_url', $forward_url); ?>
	            <?php endif; ?>
	            
	            <fieldset class="box">
	               <legend class="caps">Search</legend>
	               <p>&nbsp;</p>
	            <p>
	                Search by <?php echo form_dropdown('criteria',
	                    array(
	                        'civl_id' => 'CIVL ID',
	                        'name'  => 'Name'
	                    ), (isset($criteria)? $criteria : 'civl_id')); ?>
	                where the search term 
	                <?php echo form_dropdown('type',
	                    array(
	                        'exactly' => 'is exactly',
	                        'beginsw'  => 'begins with',
	                        'endsw'  => 'ends with',
	                        'contains'  => 'contains',
	                    ), (isset($type)? $type : 'exactly')); ?>
	                <?php echo form_input('term', (isset($term)? $term : ''), 'class="inline" size="10" maxlength="200"')?>
	            </p>
	            
	            <p><?php echo form_submit('action', 'Search')?></p>
	            </fieldset>
	            <?php echo form_close(); ?>
	        </div>
	        
	        <div id="search-results">
                <h3>Search Results</h3>
	            <?php if (isset($results)): ?>
	                <ul>
	                <?php foreach ($results as $r): ?>
	                    <li>
	                        <?php echo $r['id'] ?> - <?php echo $r['name']?> 
	                        [ <?php echo anchor('profile/person/edit/'.$r['id'], 'Modify'); ?> ]
	                    </li>
	                <?php endforeach; ?>
	                </ul>
	            <?php else: ?>
	            <p>No results found for your query.</p>
	            <?php endif; ?>
	        </div>
        </div> <!-- end content -->
        <?php $this->load->view('menu/admin')?>
    </div> <!-- end container -->
</div> <!-- end main -->
<?php $this->load->view('footer/standard');?>
